<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/web/pub/head.inc"%>
<%@ include file="/pub/head_bootstrap.inc"%>
<link href="${baseURL}/themes/default/css/sdApp.min.css" rel="stylesheet" type="text/css" />
<title>菜单管理</title>
	<style>
.l-group span {
	float: none;
}

.l-text.l-text-combobox {
	width: 250px;
}

.FrameWindow .window-menu {
    width: 97%;
    margin: 10px 1%;
    position: fixed;
    top: 0px;
    text-align: left;
    background: #fff;
    border-bottom: 1px solid #dff0fe;
    z-index: 9;
    border: 1px solid rgba(233, 237, 247, 0.8);
}
.modal-content *{
	text-align: center !important
}
</style>
</head>
<body id="mybody" style="background:#fff">
	<div class="FrameWindow tabFrameWindow">
		<div class="window-menu">
			<div class="menuInner">
				<button type="button" class="btn btn-normal btn-blue"
					onclick="FF_Save()">保存</button>
				<button type="button" class="btn btn-normal btn-white"
					onclick="FF_Cancel()">取消</button>
			</div>
		</div>
		<!-- window-menu -->
		<div class="FrameWindowInner">
			<%--<div class="location"
				style="height: 32px; letter-spacing: 2px; color: #525771">
				<i class="fa fa-map-marker"
					style="color: #2684ce; font-size: 18px; vertical-align: top; margin-right: 8px; margin-bottom: -2px"></i>菜单编辑
			</div>--%>

			<!-- top-card -->

			<div class="cont-table tab-content">
				<!-- 机构信息 -->
				<div class="tab-pane fade in active" id="mainTab">
					<form onsubmit="return false;" id="mainform" class="table-normal">
						<input type="hidden" name="id" value="${viewDictionary.id }"/>
						<div class="cont-table tab-content" style="width: 98%">
							<table>
								<tbody>
									<tr>
										<th align="right"><font color="red">*</font>名称：</th>
										<td><input id="name" name="name" class="illegalRequest"
											type="text" value="${viewDictionary.name }"
											validate="{required:true}" /></td>
									</tr>
									<tr>
										<th align="right"><font color="red">*</font>业务类型：</th>
										<td>
											<select name="busi">
												<c:forEach var="o" items="${busiList}" >
													<option value="${o.id}" <c:if test='${o.id eq viewDictionary.busi}'>selected</c:if>>${o.busiName}</option>
												</c:forEach>
											</select>
										</td>
									</tr>
									<tr>
										<th align="right"><font color="red">*</font>排序号：</th>
										<td><input id="priority" name="priority"
												   value="${viewDictionary.priority }"
												   class="illegalRequest" type="text"
												   validate="{required:true}"
										/></td>
									</tr>
									<tr>
										<th align="right"><font color="red">*</font>处理方式：</th>
										<td>
											<c:forEach var="o" items="${handleTypewayList}" >
												<input type="checkbox" name="ways" value="${o.id }"/><span title="${o.pageRemark}">${o.handleWayName }</span>
											</c:forEach>
										</td>
									</tr>
									<tr>
										<th align="right">待办URL：</th>
										<td><input maxlength="1000" inputwidth="365"
											id="viewUrl" name="viewUrl"
											value="${viewDictionary.viewUrl }"
											class="illegalRequest" type="text" style="height: 30px"
											" /></td>
									</tr>
									<tr>
										<th align="right">查阅URL：</th>
										<td ><input
											maxlength="1000" inputwidth="365" id="spreadUrl"
											name="spreadUrl" class="illegalRequest" type="text"
											value="${viewDictionary.spreadUrl }"
											style="height: 30px" /></td>
									</tr>
									<tr>
										<th align="right">已办URL：</th>
										<td>
											<input
													maxlength="1000" inputwidth="365" id="doneUrl"
													name="doneUrl" class="illegalRequest" type="text"
													value="${viewDictionary.doneUrl }"
													style="height: 30px" />
										</td>
									</tr>
									<tr>
										<th align="right">待办预览URL：</th>
										<td><input maxlength="1000" inputwidth="365"
											id="previewUrl" name="previewUrl" class="illegalRequest"
											value="${viewDictionary.previewUrl }"
											type="text" style="height: 30px" /></td>
									</tr>
									<tr>
										<th align="right">说明：</th>
										<td>
											<textarea name="remark" cols="70" rows="2">${viewDictionary.remark }</textarea>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</form>

				</div>
			</div>

		<script type="text/javascript">
		//parent.ChangeIframeHeight("fform","800px");
		//编辑，新增
		var mainform = $("#mainform");
		//添加验证
		jQuery.metadata.setType("attr", "validate");

		function checkForm() {
            var len = $("input[type='checkbox']:checked").length;
            if (len === 0) {
                BT.showError("请选择处理方式！");
				return false;
			}
			return true;
		}

		//保存
		function FF_Save() {
            if (!checkForm()) {
                return;
            }
			mainform.attr("action","${ROOT}/engine/flow/action/viewdictionary/saveViewDictionary.do");
            BT.submitForm(mainform, function(data) {
                var win = parent || window;
                if (data.hasOk) {
                    BT.showSuccess('保存成功！', function () {
                    	win.LG.closeAndReloadParent("ViewDictionaryEdit", "${param.menuId}");
                    })
                } else {
                    BT.showError("操作失败!失败信息如下:\n" + data.message);
                }
            })
		}

        function FF_Cancel() {
            try {
                var win = parent || window;
                win.LG.closeCurrentTab("ViewDictionaryEdit");
            } catch (e) {
                window.history.go(-1);
            }
        }

        function initFunction(){
            var ways = '${viewDictionary.ways}';
            if(ways!=null&&ways!=""){
                var way = ways.split(",");
                var handleTypeway = document.getElementsByName("ways");
                for(var i=0;i<handleTypeway.length;i++){
                    for(var j=0;j<way.length;j++){
                        if(handleTypeway[i].value==way[j]){
                            handleTypeway[i].checked = true;
                            break;
                        }
                    }
                }
            }
        }

        $(function() {
            initFunction()

			$('input[name="way"]').click()
		})
	</script>
</body>
</html>